package com.unism.licence;

import java.net.URL;
import java.text.SimpleDateFormat;


public class Test {

	public static void main(String[] args){
		String licenceFileName = "licence.xml" ;
		URL path = Test.class.getResource(licenceFileName);
		CheckLicence ch = new CheckLicence() ;
		boolean flag = ch.doCheck(path) ;
		if(flag){
			flag = ch.isValidLife() ;
			if(flag){
				System.out.println("验证通过");
				
				System.out.println("项目名称:" + ch.getProjectName()) ;
				System.out.println("允许接入最大终端数:" + ch.getClientsNum()) ;
				System.out.println("许可发布期:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(ch.getIssueDt())) ;
				System.out.println("许可有效期长:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(ch.getValidLife())) ;
				
			}else{
				System.out.println("验证未通过");
			}
		}else{
			System.out.println("验证未通过");
		}
		
	}
}
